<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let s1 = Symbol("foo");
      let s2 = Symbol("foo");
      //   console.log(s1);
      //   console.log(s2);
      console.log(s1 === s2); //false

      let ms = Symbol.for("foo");
      let ms2 = Symbol.for("foo");
      console.log(ms === ms2); //true
      //   let mySymbol = Symbol();
      //   let mySymbol2 = Symbol();

      //   let a = {};
      //   a[mySymbol] = "hello";
      //   a[mySymbol2] = "abc";
      //   a.myObj = "obj";
      // let a ={
      //     [mySymbol] :'hello',
      // }
      //       let a={};
      //      Object.defineProperty(a,mySymbol,{
      //         value:'hello'
      //      })
      // console.log(a[mySymbol]);
      //for...in，for...of,Object.key循环无法遍历symbol类型的数据
      //   for (const key in a) {
      //     console.log(key);
      //   }
      //   let arr = Object.getOwnPropertySymbols(a);
      //   console.log(arr[0]);
     
      
    </script>
  </body>
</html>
